package com.codi.bus.core.sys.web.portfolio.controller;

import com.codi.base.domain.BaseResult;
import com.codi.bus.core.domain.BankLimit;
import com.codi.bus.core.service.BankLimitService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/banklimit")
public class BankLimitController {
    @Autowired
    BankLimitService bankLimitService;

    @GetMapping("/all")
    public BaseResult get() {
        return BaseResult.success(bankLimitService.selectAll());
//        log.debug("{}", bankLimitService.selectAll());
    }

    @PostMapping
    public BaseResult save(BankLimit bankLimit) {
        return bankLimitService.add(bankLimit);
    }

    @GetMapping
    public BaseResult get(BankLimit bankLimit) {
        return bankLimitService.selectOne(bankLimit.getId());
    }

    @PostMapping("/delete")
    public BaseResult delete(BankLimit bankLimit) {
        return bankLimitService.delete(bankLimit.getId());
    }

    @PostMapping("/update")
    public BaseResult update(BankLimit bankLimit) {
        return bankLimitService.update(bankLimit);
    }
}
